package stone.ast;

import java.util.List;

public class DefStmt extends ASTList {
  public DefStmt(List<ASTree> list) {
    super(list);
  }

  public String name() {
    return ((ASTLeaf) child(0)).getToken().getText();
  }

  public ParameterList parameters() {
    return (ParameterList) child(1);
  }

  public BlockStmt body() {
    return (BlockStmt) child(2);
  }

  @Override
  public String toString() {
    return "(def " + name() + " " + parameters() + " " + body() + ")";
  }
}
